package ArrDemo;

public class ArrDemo6 {
    public static void main(String[] args) {
        //定义一个数组
        int[] arr = {3, 5, 6, 7, 8, 9};

        //交换数组中的元素
        for (int i = 0, j = arr.length - 1; i < j; i++, j--) {
            int temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }

        //输出
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }

    }
}
